
using Newtonsoft.Json;
using System.Net.Http.Json;
using System.Net.Sockets;
﻿using System.Net.Sockets;


﻿using Newtonsoft.Json;
using System.Net.Http.Json;
using System.Net.Sockets;

﻿using System.Net.Sockets;


namespace TcpClinet
{
    internal class Program
    {
        static async Task Main(string[] args)
        {

            //string server = "203.135.98.233"; // 服务器的IP地址，这里假设服务器和客户端都在同一台机器上  

            //int port = 40003; // 与服务器监听的端口相匹配 
            string server = "172.25.112.1"; // 服务器的IP地址，这里假设服务器和客户端都在同一台机器上  

            int port = 502; // 与服务器监听的端口相匹配 

            TcpClientHelper tcpHelper = new TcpClientHelper();
            await tcpHelper.InitConnection(server, port);

            Class1 class1 = new Class1()
            {
                imei = 1,
                type = 0,
                time = DateTime.Now,
                faultState = 1,
                maintenanceState = 0,
                onOffState = 0,
            };
            
            var receive = await tcpHelper.SendDataAndGetResponse(JsonConvert.SerializeObject(class1));
            Console.WriteLine($"接收到的信息{receive}");

        }

    }
}

